package tongkeyon.create.singleton;

/**
 * @Author: keyon <tongkeyon@163.com>
 * @Date: 2020/2/17 10:33
 * @Version 1.0
 */

//既然懒汉式存在并发问题那么使用synchronized来同步
//这样虽然可以解决并发问题单效率太低
public class Type3 {


    private Type3(){

    }

    private  static Type3 ty=null;

    public static synchronized Type3 getInstance(){
        if (ty ==null){
            ty=new Type3();
        }
        return ty;

    }
}
